clear all
load ParEst_eh0_time0_Mex_guys
load ParEst_eh0_time0_Mex_guys_allboots
ParEst_eh0_time0_Mex_guys_all_boots=ParEst_eh0_time0_Mex_guys_allboots;
load ParEst_eh0_time2_Mex_guys
load ParEst_eh0_time2_Mex_guys_all_boots

ParEst_eh0_time0_Mex_guys_all_boots(:,11)=10.^ParEst_eh0_time0_Mex_guys_all_boots(:,11);

Par1 = [ParEst_eh0_time0_Mex_guys,ParEst_eh0_time2_Mex_guys]'; % estimates
Par2 = [std(ParEst_eh0_time0_Mex_guys_all_boots(:,1:end-1)),std(ParEst_eh0_time2_Mex_guys_all_boots(:,1:end-1))]'; % bootstrap estimates

Par1(11) = 10^(Par1(11)); 
Par1(12:13) = Par1(12:13)*1000;
Par1(14) = 500*Par1(14);
Par2(12:13) = Par2(12:13)*1000;
Par2(14) = 500*Par2(14);

df_1=Par1(1);
di_1=Par1(2);
lnf_1=Par1(3);
lni_1=Par1(4);
lfi_1=Par1(5);
lif_1=Par1(6);
alphaf=Par1(7);
betaf=Par1(8);
alphai=Par1(9);
betai=Par1(10);
theta=Par1(11);
a=Par1(12);
b1 = Par1(13);
gamma=Par1(14); 
alphaf_2=Par1(15);
betaf_2=Par1(16);
alphai_2=Par1(17);
betai_2=Par1(18);

sd_df_1=Par2(1);
sd_di_1=Par2(2);
sd_lnf_1=Par2(3);
sd_lni_1=Par2(4);
sd_lfi_1=Par2(5);
sd_lif_1=Par2(6);
sd_alphaf=Par2(7);
sd_betaf=Par2(8);
sd_alphai=Par2(9);
sd_betai=Par2(10);
sd_theta=Par2(11);
sd_a=Par2(12);
sd_b1 = Par2(13);
sd_gamma=Par2(14); 
sd_alphaf_2=Par2(15);
sd_betaf_2=Par2(16);
sd_alphai_2=Par2(17);
sd_betai_2=Par2(18);


load MWP_a MWP_a
load MWP_gamma MWP_gamma
load MWP_a_boot MWP_a_boot
load MWP_gamma_boot MWP_gamma_boot
sd_MWP_a=std(MWP_a_boot);
sd_MWP_gamma=std(MWP_gamma_boot);


%Contact rates
Transitions_both = {'F-N';''; 'I-N';''; 'N-F';''; 'N-I';''; 'F-I';''; 'I-F';''};
Estimates = [df_1; sd_df_1; di_1; sd_di_1; lnf_1; sd_lnf_1; lni_1; sd_lni_1; lfi_1; sd_lfi_1; lif_1; sd_lif_1];
Transition_Rates_table = table(Transitions_both, Estimates);
writetable(Transition_Rates_table, 'Transition_Rates_table.xls')

%Preference parameters
Preference = {'theta';'';'b1';'';'a';'';'gamma';'';'MWP a';'';'MWP gamma';''};
Estimates = [theta; sd_theta; b1; sd_b1; a; sd_a; gamma; sd_gamma; MWP_a; sd_MWP_a; MWP_gamma; sd_MWP_gamma];
Preferences_table = table(Preference, Estimates);
writetable(Preferences_table, 'Preferences_table.xls')

%Wage offer parameters
Wage_offer = {'alpha_formal';'';'alpha_informal';''; 'beta_formal';'';'beta_informal';''};
Estimates = [alphaf; sd_alphaf; alphai; sd_alphai; betaf; sd_betaf; betai; sd_betai];
Wage_offer_par_table = table(Wage_offer, Estimates);
writetable(Wage_offer_par_table, 'Wage_offer_par_table.xls')

%Wage offer parameters
Wage_offer = {'alpha_formal';'';'alpha_informal';''; 'beta_formal';'';'beta_informal';''};
Estimates = [alphaf_2; sd_alphaf_2; alphai_2; sd_alphai_2; betaf_2; sd_betaf_2; betai_2; sd_betai_2];
Wage_offer_par_table = table(Wage_offer, Estimates);
writetable(Wage_offer_par_table, 'Wage_offer_par_table_2nd_stage.xls')

